import {defineStore} from "pinia";

const useCategoryStore = defineStore('useCategoryStore',{
    state:()=>{
        return{
            categoryMap:{},
            categoryList:[],
            curentPCategory:{}
        }
    },
    actions:{
        saveCategoryMap(data){
            this.categoryMap = data
        },
        saverCategoryList(data){
            this.categoryList = data
        },
        saverCurentPCategory(data){
            this.curentPCategory = this.categoryMap[data]
        }
    }
},{
    persist: {
        enabled: true,//开启持久化
        key: 'useCategoryStore',//唯一标识
        storage: localStorage,//存储方式
        }
    })
export {
    useCategoryStore
}